<script src="<?php echo ThemePath(); ?>/js/bootstrap-multiselect.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<?php echo ThemePath(); ?>/css/slider.css">
<section class="create-class class-top classes-set">
    <div class="container">
        <div class="row">   
            <div class="col-lg-12 column12">         
                <div id="Bread">
                    <ol class="breadcrumb">
                        <li><a href="<?php echo SITE_URL; ?>">Home</a></li>
                        <li><a href="<?php echo $this->createUrl('/myskillhippo'); ?>">My Skillhippo</a></li>
                        <li class="active"><?php echo (!$model->isNewRecord) ? 'Update  A Course' : 'CREATE A Course'; ?></li>
                    </ol>
                </div><!--bread-->
            </div> <!--basket col--> 
        </div>
        <div class="row">  
            <div class="tab-pane" id="teach">
                <h3>Step 1: <span> Course information</span></h3><hr>
                <div class="row">                          
                    <div class="venue-teach step-first">  
                        <?php
                        $form = $this->beginWidget('GxActiveForm', array('id' => 'courses-form', 'htmlOptions' => array('enctype' => 'multipart/form-data', 'class' => 'venue-form'),
                        ));
                        ?>

                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-4 column4 course-pdl">
                                <?php echo $form->labelEx($model, 'course_titile'); ?>
                                <?php echo $form->textField($model, 'course_titile', array('maxlength' => 145, 'class' => 'form-control book-control')); ?>
                                <?php echo $form->error($model, 'course_titile'); ?>
                            </div>

                            <div class="col-lg-4 col-md-4 col-sm-4 column4">
                                <?php echo $form->labelEx($model, 'category_id'); ?>
                                <?php echo $form->dropDownList($model, 'category_id', CHtml::listData(Category::model()->findAll(array('condition' => 'status = ' . SkillConfig::STATUS_ACTIVE, 'order' => 'name ASC')), 'id', 'name'), array('empty' => 'Select Category', 'class' => 'form-control book-control')); ?>
                                <span class="class-arrow1"></span>                               
                                <?php echo $form->error($model, 'category_id'); ?>
                            </div>

                            <div class="col-lg-4 col-md-4 col-sm-4 column4">
                                <?php echo $form->labelEx($model, 'difficulty_type'); ?>                                  
                                <?php echo $form->dropDownList($model, 'difficulty_type', array("1" => "Beginner", "2" => "Intermediate", "3" => "Advance"), array('class' => 'form-control book-control')); ?>
                                <span class="class-arrow1"></span>
                                <?php echo $form->error($model, 'difficulty_type'); ?>
                            </div>
                        </div>

                        <div class="gap"></div>
                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-4 column4 course-pdl">
                                <?php echo $form->labelEx($model, 'classesTargetAudiences'); ?>                                   
                                <?php echo $form->dropDownList($model, 'classesTargetAudiences', CHtml::listData(TargetAudience::model()->findAll(array('condition' => 'status = ' . SkillConfig::STATUS_ACTIVE, 'order' => 'target_audience_name ASC')), 'id', 'target_audience_name'), array('class' => 'multiselect form-control book-control', 'multiple' => 'multiple', 'options' => getAllTargetAudience($model->id, 'course'))); ?>
                                <span class="class-arrow1"></span>
                                <?php echo $form->error($model, 'classesTargetAudiences'); ?>
                            </div>

                            <div class="col-lg-4 col-md-4 col-sm-4 column4">
                                <?php echo $form->labelEx($model, 'Suggest Course Tags'); ?>
                                <input maxlength="100" name="ClassCourseTags[tag_name]" id="ClassCourseTags_tag_name" type="text" class="form-control book-control  classTag">
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-4 column4">
                                <?php echo $form->labelEx($model, 'class_tag'); ?>
                                <?php echo $form->dropDownList($model, 'course_tag', CHtml::listData(ClassCourseTags::model()->findAll(array('condition' => 'status = ' . SkillConfig::STATUS_ACTIVE, 'order' => 'id ASC')), 'id', 'tag_name'), array('class' => 'multiselect', 'multiple' => 'multiple', 'options' => getAllTags($model->id, 'course'))); ?>
                                <span class="class-arrow1"></span>
                                <?php echo $form->error($model, 'class_tag'); ?>
                            </div>
                        </div>
                        <div class="gap"></div>
                        <div class="clearfix"></div>

                        <div class="row">
                            <div class="col-lg-8 col-md-8 col-sm-8 column8 course-pdl">
                                <div class="fun-quote">
                                    <span class="pull-left">Fun Quotient<br><span class="fun-quote-slider"></span></span>
                                    <span class="pull-right learn-me">Learn Quotient<br><span class="learn-quote-slider"></span></span></div>
                                <input id="ex1" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="<?php echo $modelFunLearning->learn; ?>" data-slider-tooltip="show"/>
                                <input type="hidden" readonly="readony" id="learingfun" value="<?php echo $modelFunLearning->learn; ?>" name="FunLearningValue[learn]" >
                                <input type="hidden" readonly="readony"id="funlearing" value="<?php echo $modelFunLearning->fun; ?>" name="FunLearningValue[fun]">
                            </div>
                            
                            <div class="col-lg-4 col-md-4 col-sm-4 column4">
                                <?php echo $form->labelEx($model, 'certificate'); ?>
                                <?php echo $form->dropDownList($model, 'certificate', array("0" => "No", "1" => "Yes"), array('class' => 'form-control book-control')); ?>
                                <span class="class-arrow1"></span>
                                <?php echo $form->error($model, 'certificate'); ?>
                            </div>
                        </div>
                        <div class="gap"></div>
                        <div class="col-lg-12 col-md-12 column12 course-pdl">
                            <?php echo $form->labelEx($model, 'course_short_description'); ?>
                            <?php echo $form->textArea($model, 'course_short_description', array('onkeyup' => 'countChar(this);', 'class' => ' form-control book-control requiredfield', 'id' => 'course_short_description')); ?>
                            <div id="charNum" class="errorMessage"></div>
                            <?php echo $form->error($model, 'course_short_description'); ?>
                             <p class="note"><?php echo Message::CLASSES_SHORT_DESC;?></p>
                        </div>
                        
                        <div class="gap"></div>
                        <div class="col-lg-12 col-md-12 column12 course-pdl">
                            <?php echo $form->labelEx($model, 'course_description'); ?>
                            <?php
                            $this->widget('common.extensions.ckeditor.CKEditor', array(
                                'model' => $model,
                                'attribute' => 'course_description',
                                'editorTemplate' => 'full',
                            ));
                            ?>
                            <?php echo $form->error($model, 'course_description'); ?>
                        </div>
                        
                       <div class="gap"></div>
                        <div class="col-lg-12 col-md-12 column12 course-pdl">
                            <?php echo $form->labelEx($model, 'course_outcome'); ?>
                            <?php
                            $this->widget('common.extensions.ckeditor.CKEditor', array(
                                'model' => $model,
                                'attribute' => 'course_outcome',
                                'editorTemplate' => 'full',
                            ));
                            ?>
                            <?php echo $form->error($model, 'course_outcome'); ?>
                        </div>
                        <div class="gap"></div>
                        
                        
                        <div class="col-lg-12 col-md-12 column12 course-pdl">
                            <?php echo $form->labelEx($model, 'course_prerequisites'); ?> 
                            <?php
                            $this->widget('common.extensions.ckeditor.CKEditor', array(
                                'model' => $model,
                                'attribute' => 'course_prerequisites',
                                'editorTemplate' => 'full',
                            ));
                            ?>
                            <?php echo $form->error($model, 'course_prerequisites'); ?>
                        </div>
                        <div class="row continue-row">
                            <div class="col-lg-12 column12">  
                                <?php echo GxHtml::submitButton(Yii::t('app', 'Save & Continue')); ?>
                            </div>
                            <div class="gap2"></div>
                            <div class="gap"></div>
                        </div>
                        <?php $this->endWidget(); ?></div><!--venue first form end here-->          
                </div><!--venue teach div end here-->  
            </div><!--venue tab row end here-->
        </div><!--teach div end here-->
    </div><!--create class container end here-->                       
</section>
<script type="text/javascript">
    $(document).ready(function() {
        $(".dynamicclass").removeAttr('id');
        var orderCount = 0;
        $('.multiselect').multiselect({
            buttonText: function(options) {
                if (options.length == 0) {
                    return 'None selected ';
                }
                else if (options.length > 2) {
                    return options.length + ' selected  ';
                }
                else {
                    var selected = [];
                    options.each(function() {
                        selected.push([$(this).text(), $(this).data('order')]);
                    });

                    selected.sort(function(a, b) {
                        return a[1] - b[1];
                    })

                    var text = '';
                    for (var i = 0; i < selected.length; i++) {
                        text += selected[i][0] + ', ';
                    }

                    return text.substr(0, text.length - 2) + ' ';
                }
            },
            onChange: function(option, checked) {
                if (checked) {
                    orderCount++;
                    $(option).data('order', orderCount);
                }
                else {
                    $(option).data('order', '');
                }
            }
        });
    });

    $('#ex1').slider({
        formater: function(value) {
            tooltip: 'always';
            $("#funlearing").val(value);
            $("#learingfun").val(100 - value);
            $('.fun-quote-slider').text(value);
            $('.learn-quote-slider').text(100 - value);
            return value;
        }
    });

</script>
                                